package com.youhp.spire.xls.demo.Worksheets;

import com.spire.xls.*;

public class PageSetup {
    public static void main(String[] args) {
        String inputFile = "data/PageSetup.xlsx";
        String outputFile = "output/PageSetup_out.xlsx";

        //Create a workbook and load a file
        Workbook workbook = new Workbook();
        workbook.loadFromFile(inputFile);

        //Get the first worksheet
        Worksheet sheet = workbook.getWorksheets().get(0);

        //Sets page orientation and paper size
        sheet.getPageSetup().setOrientation(PageOrientationType.Landscape);
        sheet.getPageSetup().setPaperSize(PaperSizeType.PaperA3);

        //Save the Excel file
        workbook.saveToFile(outputFile, ExcelVersion.Version2013);
    }
}
